package com.eascs.admin.o2o.operation.operations;

import java.text.DecimalFormat;
import java.text.Format;
import java.text.SimpleDateFormat;

import com.eascs.app.dao.PageResult;
import com.eascs.common.util.UrlUtil;
import com.eascs.site.page.PaginationInfo;
import com.eascs.site.page.SelectDataOption;
import com.eascs.site.view.button.Button;
import com.eascs.web.context.RequestContext;

public abstract class ApplyOperation implements Operation {

	@Override
	public String getSql() {
		return "sql.o2o.operation.apply";
	}

	@Override
	public PaginationInfo buildPaginationInfo(PageResult<Object[]> pageResult) {
		PaginationInfo paginationInfo = new PaginationInfo(pageResult, new String[] { "贷款单号", "借款人姓名", "借款人证件号", "经办机构", "状态", "申请金额(万元)", "创建日期","作废单号" });
		paginationInfo.setBuildPagingNavigation(true);
		paginationInfo.setUrl(UrlUtil.resetParam(RequestContext.getRequestUrlWithQueryString(), "pageIndex", ""));
		paginationInfo.setFirstRenderColumnIndex(1);
		paginationInfo.setFormats(new Format[] { null, null, null, null, null, new DecimalFormat(",##0"), new SimpleDateFormat("yyyy-MM-dd") });
		paginationInfo.setSelectDataOptions(new SelectDataOption[] { null, null, null, null, new SelectDataOption("SQZT") });
		paginationInfo.setMoreButtons(getOperationButtons());
		paginationInfo.setTitleButtons(getTitleButtons());
		return paginationInfo;

	}

	public abstract Button[] getOperationButtons();
	public abstract Button[] getTitleButtons();	
	@Override
	public String getView() {
		return "/o2o/operation/index";
	}

}
